package com.singzi.newcode.pdd;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int sum = 0;
        if(n >= 0 && n < 10){
            System.out.println(n);
        }else if (n > 45 ) {
            System.out.println(-1);
        }else{
            int cont = 0, get = 1;
            for(int i = 9;i > 0;i--){
                if(n < 9 - cont){
                    break;
                }
                sum = i*get + sum;
                get *=10;
                cont++;
                n = n-i;
            }
            System.out.println(n * get + sum);

        }

    }
}
